<!DOCTYPE html>
<html>
<head>
<include file="Include:meta" />
<title>我参与的项目-目的地运营集团数据管理平台</title>
<include file="Include:style" />
</head>
<body>
<include file="Include:header" />
<include file="Include:left" />
<div id="main">
	<div class="crumbs">
		<div class="crumbs-text">我参与的项目</div>
		<div class="right">
			<div class="input-group left w250">
		    	<input type="text" id="keyword" value="{$keyword}" class="form-control" placeholder="按项目编号/名称/经理/总监搜索" autocomplete="off">
	    		<span class="input-group-btn">
	        		<button class="btn found_btn" type="button">搜索</button>
		    	</span>
		    </div>
		</div>
	</div>
	<div id="content">
		<div class="filter">
			<div class="filter-item">
				<div class="filter-title">所属中心：</div>
				<ul class="filter-order">
					<li <if condition="$center_id eq -10">class="current"</if>>
						<a href="__APP__/Index/my_project/keyword/{$keyword}/center_id/-10/status/{$status}">全部</a>
					</li>
					<li <if condition="$center_id eq 130004">class="current"</if>>
						<a href="__APP__/Index/my_project/keyword/{$keyword}/center_id/130004/status/{$status}">建设管理</a>
					</li>
					<li <if condition="$center_id eq 130005">class="current"</if>>
						<a href="__APP__/Index/my_project/keyword/{$keyword}/center_id/130005/status/{$status}">运营管理</a>
					</li>
					<li <if condition="$center_id eq 130003">class="current"</if>>
						<a href="__APP__/Index/my_project/keyword/{$keyword}/center_id/130003/status/{$status}">拓展中心</a>
					</li>
					<li <if condition="$center_id eq 130011">class="current"</if>>
						<a href="__APP__/Index/my_project/keyword/{$keyword}/center_id/130011/status/{$status}">景翼</a>
					</li>
				</ul>
			</div>
			<div class="filter-item">
				<div class="filter-title">项目状态：</div>
				<ul class="filter-order">
					<foreach name="project_status" item="vo">
					<li <if condition="$status eq $vo['name2']">class="current"</if>>
						<a href="__APP__/Index/my_project/keyword/{$keyword}/center_id/{$center_id}/status/{$vo['name2']}">{$vo['name1']}</a>
					</li>
					</foreach>
				</ul>
			</div>
		</div>
		<div class="table-scrollx">
			<table class="table table-bordered table-hover">
				<tr class="table-header fixed-table-header">
					<td width="168">项目编号</td>
					<td width="418">项目名称</td>
					<td width="102">项目经理/项目负责人</td>
					<td width="102">项目总监/项目群负责人</td>
					<td width="86">启动日期</td>
					<td width="86">记录数</td>
				</tr>
				<if condition="$result eq NULL">
				<tr>
					<td colspan="6" class="text-center">暂无相关内容</td>
				</tr>
				</if>
				<foreach name="result" item="vo">
				<tr>
					<td><a href="__APP__/Project/project_situation/id/{$vo['id']}" target="_blank">{$vo['project_num']}</a></td>
					<td>{$vo['project_name']}</td>
					<td>{$vo['manager_name']}</td>
					<td>{$vo['director_name']}</td>
					<td>{$vo['start_date']}</td>
					<td><if condition="$vo['num'] gt 0 and ($vo['manager_uid'] eq $login_id or $vo['director_uid'] eq $login_id or get_permission('XM',1,1))"><a href="__APP__/Project/project_files/id/{$vo['id']}" target="_blank">{$vo['num']}</a></if></td>
				</tr>
				</foreach>
			</table>
		</div>
		<div class="pages">{$page}</div>
	</div>
</div>
<!--对话框-->
<div class="modal fade" id="myModal-operate">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<h4>操作提示框</h4>
				<i class="fa fa-times" aria-hidden="true" data-dismiss="modal"></i>
			</div>
			<div class="modal-body">
				<table class="table table-bordered">
					<tr>
						<td class="text-right" width="50"><strong><span class="asterisk">*</span>日期</strong></td>
						<td>
							<input type="text" class="form-control Wdate stop_date w100" onclick="WdatePicker()" readonly autocomplete="off">
							<span class="error-item">必填项</span>
						</td>
					</tr>
					<tr>
						<td class="text-right"><strong><span class="asterisk">*</span>状态</strong></td>
						<td>
							<label class="radio-inline">
								<input type="radio" class="type" name="type[]" value="-1" autocomplete="off">暂停
							</label>
							<label class="radio-inline">
								<input type="radio" class="type" name="type[]" value="-2" autocomplete="off">完结(中止)
							</label>
							<label class="radio-inline">
								<input type="radio" class="type" name="type[]" value="-3" autocomplete="off">完结(终止)
							</label>
							<span class="error-item">必填项</span>
						</td>
					</tr>
					<tr>
						<td class="text-right"><strong><span class="asterisk">*</span>原因</strong></td>
						<td>
							<textarea name="remark" class="form-control w300 reason left" autocomplete="off"></textarea>
							<span class="error-item left">必填项</span>
						</td>
					</tr>
				</table>
			</div>
			<div class="modal-footer">
				<button type="button" class="btn btn-affirm">确认</button>
				<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
			</div>
		</div>
	</div>
</div>
<include file="Include:javascript" />
<script type="text/javascript">
$(function(){
	//搜索
	$(".found_btn").keywordSearch("__APP__/Index/my_project/keyword/$keyword/center_id/{$center_id}/status/{$status}");

	//启用
	$(".start-using").ajaxModal({"title_text":"启用提示框","body_text":"您确定要启用该项目吗？","url":"__APP__/Project/project_status","data":{"id":"mid","status":"status"}});

	//操作
	$(".operate").on("click",function(){
		var mid = $(this).attr("mid");
		$("#myModal-operate").modal().find(".btn-affirm").attr({"mid":mid});
	});

	//确认操作
	$("#myModal-operate").find(".btn-affirm").on("click",function(){
		var tag = true,
			modal = $("#myModal-operate");

		if(modal.find(".type:checked").length==0){
			$(".type").parent("label").nextAll(".error-item").show();
			tag = false;
		}
		modal.find(".reason").each(function(){
			var val = $(this).val();
			if(val=="" || /^\s+$/.test(val)){
				$(this).next(".error-item").show();
				tag = false;
			}
		});
		modal.find(".stop_date").each(function(){
			if($(this).val()==""){
				$(this).next(".error-item").show();
				tag = false;
			}
		});

		if(tag){
			var mid = $(this).attr("mid"),
				remark = modal.find(".reason").val(),
				status = modal.find(".type:checked").val(),
				stop_date = modal.find(".stop_date").val();
			modal.hide();
			$.ajax({
				type:"POST",
				asnyc:false,
				dataType:"json",
				data:{"id":mid,"status":status,"remark":remark,"stop_date":stop_date},
				url:"__APP__/Project/project_status",
				success:function(data){
					success_pop(data['status'],data['msg']);
				}
			});
		}
	});

	//取消错误提示
	$("#myModal-operate").find(".type").on("click",function(){
		$(this).parent("label").nextAll(".error-item").hide();
	});
	$("#myModal-operate").find(".reason,.stop_date").on("focus",function(){
		$(this).next(".error-item").hide();
	});

	//取消操作
	$("#myModal-operate").on('hidden.bs.modal',function(){
		$(this).find(".error-item").hide();
		$(this).find(":radio").prop("checked",false);
		$(this).find(".reason,.stop_date").val("");
	});
	
	$(document).on("change","[name='project_num']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Project/project_list/keyword/{$keyword}/center_id/{$center_id}/status/{$status}/project_num/"+val+"/project_name/{$project_name}/manager_uid/{$manager_uid}/director_uid/{$director_uid}";
	});
	
	$(document).on("change","[name='project_name']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Project/project_list/keyword/{$keyword}/center_id/{$center_id}/status/{$status}/project_num/{$project_num}/project_name/"+val+"/manager_uid/{$manager_uid}/director_uid/{$director_uid}";
	});
	
	$(document).on("change","[name='manager_uid']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Project/project_list/keyword/{$keyword}/center_id/{$center_id}/status/{$status}/project_num/{$project_num}/project_name/{$project_name}/manager_uid/"+val+"/director_uid/{$director_uid}";
	});
	
	$(document).on("change","[name='director_uid']",function(){
		var val = $(this).val();
		window.location.href="__APP__/Project/project_list/keyword/{$keyword}/center_id/{$center_id}/status/{$status}/project_num/{$project_num}/project_name/{$project_name}/manager_uid/{$manager_uid}/director_uid/"+val;
	});
});
</script>
</body>
</html>